
<h1><span class="yiyi-st" id="yiyi-12">numpy.core.records.fromarrays</span></h1>
        <blockquote>
        <p>原文：<a href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.core.records.fromarrays.html">https://docs.scipy.org/doc/numpy/reference/generated/numpy.core.records.fromarrays.html</a></p>
        <p>译者：<a href="https://github.com/wizardforcel">飞龙</a> <a href="http://usyiyi.cn/">UsyiyiCN</a></p>
        <p>校对：（虚位以待）</p>
        </blockquote>
    
<dl class="function">
<dt id="numpy.core.records.fromarrays"><span class="yiyi-st" id="yiyi-13"> <code class="descclassname">numpy.core.records.</code><code class="descname">fromarrays</code><span class="sig-paren">(</span><em>arrayList</em>, <em>dtype=None</em>, <em>shape=None</em>, <em>formats=None</em>, <em>names=None</em>, <em>titles=None</em>, <em>aligned=False</em>, <em>byteorder=None</em><span class="sig-paren">)</span><a class="reference external" href="http://github.com/numpy/numpy/blob/v1.11.3/numpy/core/records.py#L562-L625"><span class="viewcode-link">[source]</span></a></span></dt>
<dd><p><span class="yiyi-st" id="yiyi-14">从数组的（平面）列表创建一个记录数组</span></p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">x1</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">4</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">x2</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="s1">&apos;a&apos;</span><span class="p">,</span><span class="s1">&apos;dd&apos;</span><span class="p">,</span><span class="s1">&apos;xyz&apos;</span><span class="p">,</span><span class="s1">&apos;12&apos;</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">x3</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mf">1.1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">4</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">r</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">core</span><span class="o">.</span><span class="n">records</span><span class="o">.</span><span class="n">fromarrays</span><span class="p">([</span><span class="n">x1</span><span class="p">,</span><span class="n">x2</span><span class="p">,</span><span class="n">x3</span><span class="p">],</span><span class="n">names</span><span class="o">=</span><span class="s1">&apos;a,b,c&apos;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">r</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
<span class="go">(2, &apos;dd&apos;, 2.0)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">x1</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">=</span><span class="mi">34</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">r</span><span class="o">.</span><span class="n">a</span>
<span class="go">array([1, 2, 3, 4])</span>
</pre></div>
</div>
</dd></dl>
